package Search.a01BasicSearchdemo1;

public class Test2 {
    public static void main(String[] args) {
        int[] arr = {131, 127, 147, 81,81};
        int num = 81;
        int index = getIndex(arr, num);
        System.out.println(index);
    }

    public static int getIndex(int[] arr, int num) {
        for (int i = 0; i < arr.length; i++) {
            if (num == arr[i]) {
                return i;
            }
        }
        return -1;
    }
}
